package zhongbo.java.air.dictionary.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.PastOrPresent;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@ApiModel("警戒区域配置表")
@TableName("air_alert_zone")
public class AlertZone {

    @TableId(type = IdType.ASSIGN_UUID)
    @ApiModelProperty(value = "主键id", example = "1")
    @NotNull(message = "主键不能为空")
    @Size(min = 1, max = 36, message = "主键ID长度必须在1到36字符之间")
    private String id;

    @ApiModelProperty(value = "区域业务编号", example = "BJ_NOFLY_001")
    @Size(min = 1, max = 20, message = "区域业务编号长度必须在1到20字符之间")
    @NotNull(message = "区域业务编号不能为空1")
    @TableField("zone_code")
    private String zoneCode;

    @ApiModelProperty(value = "区域类型", example = "NO_FLY")
    @NotNull(message = "区域类型不能为空")
//    @Pattern(regexp = "^(NO_FLY|RESTRICTED|TEMPORARY)$", message = "状态必须是 NO_FLY, RESTRICTED 或 TEMPORARY")
    @TableField("zone_type")
    private String zoneType;

    @ApiModelProperty(value = "多边形定点坐标", example = "{\"lat\":39.9,\"lng\":116.3}")
    @NotNull(message = "多边形定点坐标不能为空")
    @TableField("vertices")
    private String vertices;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @PastOrPresent(message = "创建时间必须是过去或现在")
    @ApiModelProperty(value = "生效开始时间", example = "2025-03-31 21:07:47")
    @TableField("effective_start")
    private Date effectiveStart;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @PastOrPresent(message = "创建时间必须是过去或现在")
    @ApiModelProperty(value = "生效结束时间", example = "2025-03-31 21:07:47")
    @TableField("effective_end")
    private Date effectiveEnd;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @PastOrPresent(message = "创建时间必须是过去或现在")
    @ApiModelProperty(value = "创建时间", example = "2025-03-31 21:07:47")
    @TableField("create_time")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "更新时间", example = "2025-03-31 21:07:47")
    @PastOrPresent(message = "创建时间必须是过去或现在")
    @TableField("update_time")
    private Date updateTime;
}
